﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;

namespace DAL.CashManagerDAL
{
    public class CMAEHasReportOfBankDAL
    {
        private readonly string _connStr;
        private SqlConnection _conn;
        private SqlDataAdapter _adapter;
        private DataTable _dt;
        public CMAEHasReportOfBankDAL()
        {
            _connStr = ConfigurationManager.ConnectionStrings["AMIE_DB"].ConnectionString;
        }

        public DataTable emptyTable()
        {
            _conn = new SqlConnection(_connStr);
            string query = "SELECT No, AccountID, AccountName, Value, Description From Debit_Credit_MemoDetail WHERE Id = -1";
            _adapter = new SqlDataAdapter(query, _conn);

            _dt = new DataTable();
            try
            {
                _conn.Open();
                _adapter.Fill(_dt);
                return _dt;
            }
            catch
            {
                throw;
            }
            finally
            {
                _dt.Dispose();
                _adapter.Dispose();
                _conn.Close();
                _conn.Dispose();
            }
        }
    }
}
